<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>6.对象写法简化</title>
</head>
<body>

<script>
  let name = 'zzl'
  let f1 = function () {
    console.log('f1')
  }

  //对象的属性名和变量名称一样，可以简写
  //方法的定义也可以简写，去掉function
  let p1 = {
    name,
    f1,
    f2(){
      console.log('this is f2')
    }
  }
  p1.f1()
  p1.f2()


</script>
</body>
</html>